package com.itshare.video.redis;

import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.data.redis.core.RedisTemplate;

import javax.annotation.Resource;
import java.time.Duration;

/**
 * @Author lyr
 * @create 2020/10/25 19:54
 */
@SpringBootTest
public class RedisCC {


    @Resource
    private RedisTemplate<String, Object> redisTemplate;

    @Test
    public void lll() {
        redisTemplate.opsForValue()
                .set("22","1", Duration.ofSeconds(6666));
    }

    @Test
    public void printSet() {
        Long l1 = redisTemplate.opsForSet().add("testSet",1);
        Long l2 = redisTemplate.opsForSet().add("testSet",1);
        Long l3 = redisTemplate.opsForSet().add("testSet",1);
        System.out.println(l1+" "+" "+l2+" "+l3);
        System.out.println("size " + redisTemplate.opsForSet().size("testSet"));
    }
}
